<style type="text/css">
    .sheet tr.selected td { background-color: #f2f2f2; }
    .jqtree-tree .jqtree-toggler.jqtree-closed,
    .jqtree-tree .jqtree-toggler { padding: 0; background-position: 0 3px; }
    #prompt{background: url(../../public/images/icon/prompt.png);  width: 30px;height: 27px;display: inline-block;}
</style>
<div ng-controller="HousesParamController">
    <div class="tab-sm f14 mt20 clearfix">
        <ul>
            <li ng-class="{'tab-sm-on':tab.value==tabSelectedValue}" ng-repeat="tab in tabs"
                ng-click="setTabSelected(tab)">
                <a href="javascript:;">{{tab.name}}</a>
            </li>
        </ul>
        <div class="tab-sm-bottom-line"></div>
    </div>
    <div class="mt20 clearfix">
        <div class="fr btn-group">
            <a href="javascript:;" class="btn btn-yellow permission p-500302-05-inline-block"
               ui-dialog="新增选项"
               ui-dialog-ok="add($data,$dialog,$dialogScope)"
               ui-dialog-cache="false"
               ui-dialog-url="inc/dialog/param_list_edit.html"><i class="btn-icon-add"></i>新增选项</a>
            <a href="javascript:;" class="btn permission p-500302-08-inline-block" ng-click="reset()">还原备选项</a>
        </div>
    </div>
    <div class="sheet">
        <table width="100%" class="mt5 jqtree-tree">
            <thead>
            <tr>
                <th height="34" style="width:120px;text-align: left;padding-left:25px;">序号</th>
                <th>选项名称</th>
                <th style="width:120px">状态</th>
                <th style="width:120px">是否默认</th>
                <th style="width:300px">操作</th>
            </tr>
            </thead>

            <tbody ng-if="loading">
            <tr height="60">
                <td colspan="5">加载中...</td>
            </tr>
            </tbody>

            <tbody ng-if="!loading && (!list || list.length==0)">
            <tr height="60">
                <td colspan="5">查询条件无数据</td>
            </tr>
            </tbody>

            <tbody ng-if="!loading && list && list.length>0">
            <tr list-tpl ng-repeat="item in list"></tr>
            </tbody>
        </table>
    </div>
</div>

<script id="list_tpl" type="text/template">
    <tr ng-class="{selected:selectedItem === item}" ng-if="!item.parent || item.parent.open">
        <td height="34" style="text-align: left;padding-left:25px;" ng-style="{'padding-left':(item.level+1)*25}"
            ng-click="clickItem(item,$event)">
            <a class="jqtree_common jqtree-toggler"
               ng-class="{'jqtree-closed':!item.open}"
               ng-if="item.children && item.children.length>0"
               ng-click="clickItemCollapse(item)">▼</a>
            {{$index+1}}
        </td>
        <td ng-click="clickItem(item,$event)">
            <span class="icon-lock" ng-if="item.IsSystem==1"></span>{{item.Text}}
        </td>
        <td ng-click="clickItem(item,$event)">
            <i ng-if="item.Disabled != '1'" class="c-blue">已启用</i>
            <i ng-if="item.Disabled == '1'" class="c-blue">已禁用</i>
        <td ng-click="clickItem(item,$event)">
            <a ng-if="item.IsDefault != '1'" href="javascript:;"
               class="c-blue permission p-500302-06-inline-block"
               ng-click="setDefault(item)">设为默认</a>
            <i ng-if="item.IsDefault == '1'" class="icon-op icon-op-check">&nbsp;</i>
        </td>
        <td style="text-align: left;">
            <a href="javascript:void(0)" ng-if="tabSelectedValue=='DealProductType'" title="关联" style="margin-left: 40px;"
                class="mr15 permission p-500302-06-inline-block"
                ui-dialog="绑定ERP成交产品类型"
                ui-dialog-data="item.Text"
                ui-dialog-show="getProductCategroyList(item,$dialog,$dialogScope)"
                ui-dialog-ok="saveProductCategory($data,$dialog,$dialogScope)"
                ui-dialog-cache="false"
                ui-dialog-url="inc/dialog/link_projects.html">
                <i class="icon-op icon-op-link">&nbsp;</i>
            </a>
            <a href="javascript:void(0)" title="编辑"
               class="mr15 permission p-500302-06-inline-block"
               ui-dialog="编辑选项"
               ui-dialog-data="item"
               ui-dialog-show="showEditPop($data,$dialog,$dialogScope)"
               ui-dialog-ok="edit($data,$dialog,$dialogScope)"
               ui-dialog-cache="false"
               ui-dialog-url="inc/dialog/param_list_edit.html">
                <i class="icon-op icon-op-edit">&nbsp;</i>
            </a>
            <a href="javascript:void(0)" title="启用" class="mr15 permission p-500302-06-inline-block"
               ng-click="setEnable(item)" ng-if="item.Disabled == '1'">
                <i class="icon-op icon-op-star">&nbsp;</i>
            </a>
            <a href="javascript:void(0)" title="禁用" class="mr15 permission p-500302-06-inline-block"
               ng-click="setDisable(item)" ng-if="item.Disabled != '1'">
                <i class="icon-op icon-op-stop">&nbsp;</i>
            </a>
            <a href="javascript:void(0)" title="删除" class="mr15 permission p-500302-07-inline-block"
               ng-click="delete(item)">
                <i class="icon-op icon-op-del">&nbsp;</i>
            </a>
            <a href="javascript:void(0)" title="下移" ng-show="!$last"
               class="mr15 permission p-500302-06-inline-block" ng-click="moveDown(item)">
                <i class="icon-op icon-op-down">&nbsp;</i>
            </a>
            <a href="javascript:void(0)" title="上移" ng-show="!$first"
               class="permission p-500302-06-inline-block" ng-click="moveUp(item)">
                <i class="icon-op icon-op-up">&nbsp;</i>
            </a>
        </td>
    </tr>
    <tr list-tpl ng-repeat="item in item.children"></tr>
</script>